package base64;

import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;

import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;

/**
 * @author lyy
 * @date 2021/12/20
 */
public class Before {

    public static void main(String[] args) throws IOException {
        BASE64Encoder encoder = new BASE64Encoder();
        BASE64Decoder decoder = new BASE64Decoder();
        String content = "元旦快乐呀";
        String encode = encoder.encode(content.getBytes(StandardCharsets.UTF_8));
        System.out.println(encode);
        byte[] bytes = decoder.decodeBuffer(encode);
        System.out.println(new String(bytes, StandardCharsets.UTF_8));
    }

}
